//
//  ITCropImageView.h
//  ITImageDemo
//
//  Created by Seven on 20/3/10.
//  Copyright © 2016年 Seven. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ITCrossView.h"
#import "ITShowImageView.h"
typedef NS_ENUM(NSInteger, TKCropAreaCornerStyle) {
    TKCropAreaCornerStyleRightAngle,
    TKCropAreaCornerStyleCircle
};
@interface ITCropImageView : ITCrossView
@property (strong, nonatomic) ITShowImageView *imageView;
@property (strong, nonatomic) UIImage *toCropImage;
@property (assign, nonatomic) BOOL needScaleCrop;

@property (assign, nonatomic) BOOL showMidLines;//显示边线
@property (assign, nonatomic) BOOL showCorners;//显示边角

@property (assign, nonatomic) CGFloat cropAspectRatio;
@property (assign, nonatomic) CGFloat currCropAspectRatio;
@property (strong, nonatomic) UIColor *cropAreaBorderLineColor;
@property (assign, nonatomic) CGFloat cropAreaBorderLineWidth;
@property (strong, nonatomic) UIColor *cropAreaCornerLineColor;
@property (assign, nonatomic) CGFloat cropAreaCornerLineWidth;
@property (assign, nonatomic) CGFloat cropAreaCornerWidth;
@property (assign, nonatomic) CGFloat cropAreaCornerHeight;
@property (assign, nonatomic) CGFloat minSpace;
@property (assign, nonatomic) CGFloat offsetSpace;
@property (assign, nonatomic) CGFloat cropAreaCrossLineWidth;
@property (strong, nonatomic) UIColor *cropAreaCrossLineColor;
@property (assign, nonatomic) CGFloat cropAreaMidLineWidth;
@property (assign, nonatomic) CGFloat cropAreaMidLineHeight;
@property (strong, nonatomic) UIColor *cropAreaMidLineColor;
@property (strong, nonatomic) UIColor *maskColor;
@property (strong, nonatomic) UIImage *maskImage;
@property (assign, nonatomic) BOOL cornerBorderInImage;
@property (assign, nonatomic) CGFloat scaleFactor;

@property (assign, nonatomic) CGFloat tmpCornerMargin;

@property (assign, nonatomic) BOOL autoScaleCenter;//移动后居中放大
@property (assign, nonatomic) BOOL autoScale;//不够自动撑满

@property (assign, nonatomic) BOOL cycleMaskEnable;//圆形遮罩
@property (assign, nonatomic) BOOL keepCenter;//保持一直居中

@property (nonatomic, assign) BOOL showCycleLine;
@property (nonatomic, strong) CALayer *scaleIcon;
@property (nonatomic, assign) CGFloat cycleLineWidth;
@property (nonatomic, strong) UIColor *cycleLineColor;
@property (nonatomic, strong) CAShapeLayer *cycleLine;

@property(nonatomic, assign)CGFloat cycleWidth;//遮罩宽度 圆下使用

@property (assign, nonatomic) BOOL contentChangeEnable;//scrollView change

@property(nonatomic, assign)BOOL hasChanged;//是否改变

@property (strong, nonatomic) UIImageView *tmpImageView;

@property(nonatomic, assign)NSInteger firstOpenType;//0 默认根据尺寸布局  1顶部按钮打开 默认铺满


- (UIImage *)currentCroppedImage;

- (UIImage *)getFullViewImage;

- (void)onlyChangeImage:(UIImage *)image;

- (void)setImageViewFrame:(CGRect)rect;

- (CGRect)cropAreaFrame;

- (void)setNewCropImage:(UIImage *)image;

- (void)initSqureSettingWithImage:(UIImage *)image;

- (void)updateSqureWithRatio:(CGFloat)ratio;

//初始化圆
- (void)initCycleSettingWithImage:(UIImage *)image;

- (void)updateCropViewFrame:(CGRect)rect cropAspectRatio:(CGFloat)cropAspectRatio;

- (void)animationCropTransparentAreaFromRect:(CGRect)fromRect toRect:(CGRect)toRect;

- (void)showCropView:(BOOL)show;

- (UIView *)getViewWithPoint:(CGPoint)point;


- (void)setTmpImageViewHidden:(BOOL)hidden;

- (void)autoAdjustViews;
- (void)autoAdjustImageView:(BOOL)animation;
@end
